<?php
class Customer_model extends CI_Model{
	var $firstname = "";
	var $lastname = "";
	var $email = "";
	function __construct(){
	 // Call the Model constructor
        parent::__construct();
		$this->load->database();
	}
	/*
	function getCode()
	{
		$this->db->select('customerCode');
		$this->db->order_by('customerCode desc');
		$query=$this->db->get('customer');
		
		foreach($query->result() as $row ){
			return $row->customerCode;
			
		}
	}*/
	
	function create($data){
		$query = $this->db->insert('customer',$data);
		return $this->db->affected_rows();
	}
	
	function createSite(){
		$query = $this->db->insert('site');	
	}
	function getcode()
	{
		$this->db->order_by("customerCode", "desc"); 
		$this->db->select('customerCode');
		$query=$this->db->get('customer');
		
		foreach ($query->result() as $row)
		{
    		echo $row->customerCode.'<br />';
		
		}
	}
}
?>
